const { defineConfig } = require('@vue/cli-service')
//按需引入element-plus
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
//按需引入element-plus
// const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')

module.exports = defineConfig({
  transpileDependencies: true,
  //按需引入element-plus
  configureWebpack:{
    plugins: [
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
      // [new NodePolyfillPlugin()],
    ],
  },
  //按需引入element-plus

  devServer: {
    proxy: {
      '/api': {
        target: 'http://localhost:9988',//目标地址 请求的后台接口 
        ws: true,
        changeOrigin: true,
        pathRewrite:{//路径重写
          "^/api":''
        }
      },
    
    }
  }
})